/*
 * Diego Zamboni Latance 			344990
 * Fellipe Augusto Ruiz de Souza 	344796
 * 
 */
package ast;

public class WhileCommand extends Statement {

	public WhileCommand(Expr expr, Statement whileStatement) {
		this.expr = expr;
		this.whileStatement = whileStatement;
	}

	@Override
	public void genC(PW pw) {
		// empty
	}

	@Override
	public void genKrakatoa(PW pw) {
		pw.printIdent("while(");
		expr.genKrakatoa(pw, true);
		pw.print("){\n");
		pw.add();
		whileStatement.genKrakatoa(pw);
		pw.sub();
		pw.printIdent("}\n");
	}

	private Expr expr;
	private Statement whileStatement;
}
